#include <bits/stdc++.h>

#define N 25

using namespace std;

int a[5];
int tim[N];
int minn;
int l, r;

int min(int a, int b){
    if(a <= b) return a;
    else return b;
}

int max(int a, int b){
    if(a >= b) return a;
    else return b;
}

void dfs(int x, int y){ //第x道题, 第y科
    //int left = 0, right = 0;
    if(x > a[y]){
        minn = min(minn, max(l, r));
        return;
    }
    l += tim[x];
    dfs(x + 1, y);
    l -= tim[x];
    r += tim[x];
    dfs(x + 1, y);
    r -= tim[x];
}

int main(){
    int ans = 0;
    cin >> a[1] >> a[2] >> a[3] >> a[4];
    for(int i = 1; i <= 4; i++){
        l = r = 0;
        minn = 2147483646;
        for(int j = 1; j <= a[i]; j++){
            cin >> tim[j];
        }
        dfs(1, i);
        ans += minn;
    }
    cout << ans;
    return 0;
}